﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using PickGold.Callers;

namespace PickGold.Arguments
{
	/// <summary>
	/// RPC超时事件参数
	/// </summary>
	public class CRpcTimeoutEventArgs : EventArgs
	{
		private int _Timeout;
		private bool _Continue;
		private DateTime _StartTime;
		private IAsyncResult _AsyncResult;

		internal CRpcTimeoutEventArgs(IAsyncResult result, DateTime startTime)
		{
			this._StartTime = startTime;
			this._AsyncResult = result;
			this._Timeout = CRemoteProcedureCall.DefaultTimeout;
		}

		/// <summary>
		/// 获取或设置超时时间（毫秒）
		/// </summary>
		public int Timeout
		{
			set
			{
				this._Timeout = value;
			}
			get
			{
				return this._Timeout;
			}
		}

		/// <summary>
		/// 获取或设置是否继续等待
		/// </summary>
		public bool Continue
		{
			get
			{
				return this._Continue;
			}
			set
			{
				this._Continue = value;
			}
		}

		/// <summary>
		/// 调用开始时间
		/// </summary>
		public DateTime StartTime
		{
			get
			{
				return this._StartTime;
			}
		}

		/// <summary>
		/// 超时的异步操作状态对象
		/// </summary>
		public IAsyncResult AsyncResult
		{
			get
			{
				return this._AsyncResult;
			}
		}
	}
}
